package ch7;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class TestBufferReader2 {
	public static void main(String[] args) {
		try {
			BufferedWriter bw = new BufferedWriter(new FileWriter("C:\\Users\\Todd\\eclipse-workspace\\XDUJavaClass\\src\\ch7\\Test.txt"));
			String s = "";
			
			for(int i = 0; i <= 100; i++) {
				s = String.valueOf(Math.random());
				bw.write(s);
				bw.newLine();
			}
			bw.flush();
			bw.close();
			
			
			BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\Todd\\eclipse-workspace\\XDUJavaClass\\src\\ch7\\HelloWorld.java"));
			while((s = br.readLine()) != null){
				System.out.println(s);
			}
			br.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
